#!/usr/bin/python2.5

__author__ = 'Artem Dudarev'

from google.appengine.ext import db
from google.appengine.tools import bulkloader

import sys
sys.path.append('../src')
import models
from geotree.geohash import encode_coord_str

class CityLoader(bulkloader.Loader):
    def __init__(self):
        bulkloader.Loader.__init__(self, 'City',
                                   [('name', str),
                                    ('importance',float),
                                    ('coord', str)
                                   ])

    def generate_key(self, i, values):
        # values[2] - coord
        return encode_coord_str(values[2])

loaders = [CityLoader]
